package cn.happyjava.springbootsecurity.config;

import org.springframework.security.core.Authentication;
import org.springframework.security.core.GrantedAuthority;

import java.util.Collection;

/**
 * @Author: zlxiao
 * @Date: 2019/9/8 14:49
 */
public class CommonAuthentication implements Authentication {
    private String principal;
    private Collection<? extends GrantedAuthority> authorities;

    public CommonAuthentication() {
    }

    public CommonAuthentication(String principal, Collection<? extends GrantedAuthority> authorities) {
        this.principal = principal;
        this.authorities = authorities;
    }

    public Object getPrincipal() {
        return this.principal;
    }

    public String getName() {
        return this.principal;
    }

    public Object getCredentials() {
        return null;
    }

    public Object getDetails() {
        return null;
    }

    public boolean isAuthenticated() {
        return true;
    }

    public void setAuthenticated(boolean b) throws IllegalArgumentException {
    }

    public Collection<? extends GrantedAuthority> getAuthorities() {
        return this.authorities;
    }
}
